/**
 * Copyright (c) 2011 
 * All rights reserved.
 * 
 * DouBanTongCheng
 * File: ModelBase.java
 * Version 1.0 created May 31, 2011 
 */

package com.d6game.web.orm;

import java.util.HashMap;
import java.util.Iterator;

import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Transient;

/**
 * Description:
 * 统一定义id的entity基类
 * 
 * Revision History:
 * <<Date>> <<Who>> <<What>>
 * May 31, 2011  echo  initial
 */
@MappedSuperclass
public class ModelBase {
	
	@Transient
	private HashMap<String, Object> paramValues = new HashMap<String, Object>();

	public Object getParam(String key) {
		return paramValues.get(key);
	}

	public String getParamString(String key) {
		return (String)paramValues.get(key);
	}

	public void setParam(String key, Object value) {
		paramValues.put(key, value);
	}

	public Iterator<String> paramKeyIterator() {
		return paramValues.keySet().iterator();
	}

	public HashMap<String, Object> getParamValues() {
		return paramValues;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	protected Long id;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}
}

